Open
Conversation
fb7461f to
3977a4d
Compare
dazuma
suggested changes
Sep 7, 2022
| config.sampler ||= trace_config.sampler | ||
| config.span_id_generator ||= trace_config.span_id_generator | ||
| if trace_config.default_labels.present? | ||
| config.default_labels = trace_config.default_labels |
Contributor
There was a problem hiding this comment.
Can we use ||= so that the direct client config takes precedence over Rails config (for consistency with all the other configs here—note that they all use ||= or equivalent).
Contributor
Author
There was a problem hiding this comment.
||= only works on nil, but the default here is an empty Hash.
We could introduce a safeguard into the set_default_labels method that verifies we're not dealing with nil. I find the current solution more elegant, however, cause it pushes that logic to the boundary.
Let me know what you think!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a
default_labelsconfig option to Cloud Trace. The labels defined there will be added to every root span.For example, this config:
will result in the
/componentlabel being added: